package com.shzu.jwc.ty.service;

import com.shzu.jwc.ty.bean.SystemExamWeekly;
import com.shzu.jwc.ty.bean.SystemExamWeeklyExample;
import com.shzu.jwc.ty.dao.SystemExamWeeklyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExamWeekService {
    @Autowired
    SystemExamWeeklyMapper mapper;

    public List<SystemExamWeekly> getweek(){
        return mapper.selectByExample(null);
    }

    public List<SystemExamWeekly> byTypegetWeek(String systemExamWeeklyType){
        SystemExamWeeklyExample example=new SystemExamWeeklyExample();
        SystemExamWeeklyExample.Criteria criteria=example.createCriteria();
        criteria.andSystemExamWeeklyTypeEqualTo(systemExamWeeklyType);
        return mapper.selectByExample(example);
    }

    public SystemExamWeekly insert(SystemExamWeekly systemExamWeekly){
        mapper.insert(systemExamWeekly);
        Integer systemExamWeeklyId=systemExamWeekly.getSystemExamWeeklyId();
        return mapper.selectByPrimaryKey(systemExamWeeklyId);
    }

    public Integer delete(Integer systemExamWeeklyId){
        return mapper.deleteByPrimaryKey(systemExamWeeklyId);
    }

    public String byIDgetname(Integer systemExamWeeklyId){
        return mapper.selectByPrimaryKey(systemExamWeeklyId).getSystemExamWeeklyName();
    }
}
